package com.pattern.command.tenant;

import com.pattern.command.frame.Command;
import com.pattern.command.third.Service2;

public class Command2 implements Command {

    private String orderNo;

    public Command2(String orderNo) {
        this.orderNo = orderNo;
    }

    @Override
    public boolean execute() {
        System.out.println("Command2::execute() param: orderNo=" + orderNo);
        // 此处调用 RPC
        return Service2.createOrder(orderNo);
    }

    @Override
    public boolean undo() {
        System.out.println("Command2::undo() param: orderNo=" + orderNo);
        // 此处调用 RPC 接口的逆向接口
        return Service2.deleteOrder(orderNo);
    }
}
